package com.itheima.mapper;

import com.itheima.dto.EmpDto;
import com.itheima.dto.SaveEmpDto;
import com.itheima.pojo.Emp;
import com.itheima.vo.ReportJobVo;
import com.itheima.vo.ReportVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface EmpMapper {


    List<Emp> querylist(EmpDto emp);

    Integer queryCount();

    void save(Emp emp);


    void deleteById(Integer id);

    @Select("select * from emp where id = #{id}")
    Emp queryById(Integer id);

    @Select("select count(*) from emp where name = #{name}")
    int getByName(String name);


    void updateByname(SaveEmpDto empDto);

    @Select("select * from emp")
    List<Emp> queryAll();

    List<ReportVo> reportgender();


    @Select("select distinct job from emp")
    List<Integer> reportjob();

    @Select("select count(1) from emp group by job")
    List<Integer> reportjobdata();

    @Select("select * from emp where username=#{username}")
    Emp check(String username);

    @Delete("delete from emp where dept_id=#{id}")
    void deleteByDId(Integer id);

    @Update("update emp set password=#{password}   where id=#{id}")
    void changePassword(Emp emp);
}

